package com.ll.beautymall.db;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

/**
 * Created by Administrator on 2016/10/14.
 */
public class DBHelper extends SQLiteOpenHelper {

    private static final String DB_NAME = "products.db";

    private static final int DB_VERSION = 1;

    public DBHelper(Context context) {
        super(context, DB_NAME, null, DB_VERSION);
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        String sql = "CREATE TABLE collect (_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,taobao_num_iid INTEGER" +
                " ,taobao_title CHAR(100), taobao_price CHAR(100),taobao_promo_price CHAR(100),discount CHAR(10)" +
                ",taobao_pic_url CHAR(200))";
        db.execSQL(sql);

        String history = "CREATE TABLE history (_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,taobao_num_iid INTEGER" +
                " ,taobao_title CHAR(100), taobao_price CHAR(100),taobao_promo_price CHAR(100),discount CHAR(10)" +
                ",taobao_pic_url CHAR(200))";
        db.execSQL(history);

        String cart = "CREATE TABLE cart (_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,taobao_num_iid INTEGER" +
                ",taobao_title CHAR(100), taobao_price CHAR(100),taobao_pic_url CHAR(200),count INTEGER)";
        db.execSQL(cart);
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
    }

}
